package com.qixin.modules.eaApplication.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qixin.modules.ea.entity.EaSysDictItem;
import com.qixin.modules.ea.mapper.EaSysDictItemMapper;
import com.qixin.modules.ea.mapper.EaSysUserMapper;
import com.qixin.modules.ea.vo.ListPageVo;
import com.qixin.modules.eaApplication.entity.EaBusinessApply;
import com.qixin.modules.eaApplication.entity.EaBusinessPerDtl;
import com.qixin.modules.eaApplication.mapper.EaBusinessApplyMapper;
import com.qixin.modules.eaApplication.mapper.EaBusinessPerDtlMapper;
import com.qixin.modules.eaApplication.service.IEaBusinessApplyServiceCopy;
import com.qixin.modules.eaBasic.entity.EaTask;
import com.qixin.modules.eaBasic.mapper.EaRegionMapper;
import com.qixin.modules.eaBasic.mapper.EaTaskMapper;
import com.qixin.modules.eaBasic.util.ChangeIdToNameUtil;
import com.qixin.modules.eaBasic.util.WorkFlowUtil;
import com.qixin.modules.eaBasic.vo.EaTaskVo;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.*;

/**
 * @Description: 出差申请单
 * @Author: qixin-boot
 * @Date:   2021-07-02
 * @Version: V1.0
 */
@Service
public class EaBusinessApplyServiceImplCopy extends ServiceImpl<EaBusinessApplyMapper, EaBusinessApply> implements IEaBusinessApplyServiceCopy {

	@Autowired
	private EaBusinessApplyMapper eaBusinessApplyMapper;
	@Autowired
	private EaTaskMapper eaTaskMapper;
	@Autowired
	private ChangeIdToNameUtil changeIdToNameUtil;
	@Autowired
	private EaRegionMapper eaRegionMapper;
	@Autowired
	private EaSysUserMapper eaSysUserMapper;
	@Autowired
	private EaSysDictItemMapper eaSysDictItemMapper;
	@Value(value = "${server.fileurl}")
	private String fileurl;
	@Autowired
	private WorkFlowUtil workFlowUtil;
	@Autowired
	private EaBusinessPerDtlMapper eaBusinessPerDtlMapper;

	//新增出差申请单
	@Override
	@Transactional
	public Map<String,Object> saveMain(EaBusinessApply eaBusinessApply,List<EaBusinessPerDtl> eaBusinessPerDtlList) {
		Map<String,Object> returnMap = new HashMap<String,Object>();
		Object result = FillRuleUtil.executeRule("business_apply", null);  //获取单据编号
		eaBusinessApply.setBillNo(result.toString());

		String saveType = eaBusinessApply.getSaveType();
		if(saveType.equals("add")) {  //add保存,send提交
			eaBusinessApply.setState(0);   //单据状态:0未提交,1审批中,2已审批,3已退回
		}else{
			eaBusinessApply.setState(1);   //单据状态:0未提交,1审批中,2已审批,3已退回
		}

		eaBusinessApply.setId(Uuid32Util.getUUid());  //主键
		eaBusinessApply.setIfChanged(0);    //是否变更状态
		eaBusinessApplyMapper.insert(eaBusinessApply);

		//保存出行人员明细
		if(eaBusinessPerDtlList != null && eaBusinessPerDtlList.size() > 0){
			for (int i = 0; i < eaBusinessPerDtlList.size(); i++) {
				EaBusinessPerDtl eaBusinessPerDtl = eaBusinessPerDtlList.get(i);
				eaBusinessPerDtl.setId(Uuid32Util.getUUid());
				eaBusinessPerDtl.setEaBusinessApplyId(eaBusinessApply.getId());
				eaBusinessPerDtlMapper.insert(eaBusinessPerDtl);
			}
		}

		//新增待办
/*
		EaTask eaTask = new EaTask();
		eaTask.setId(Uuid32Util.getUUid());
		eaTask.setFormType("4");  //单据类型:1差旅费报销单,2借款单,3还款单,4出差申请单,5出差申请变更单,6招待费申请单,7招待费申请变更单,8招待费报销单,9资金支付审批单,10通讯报销单,11电话记录单
		//提交类型:保存:add,提交:send
		if(saveType.equals("add")){  //add保存,send提交
			eaTask.setStatus("0");
		}else{
			eaTask.setStatus("1");
		}
		eaTask.setFormId(eaBusinessApply.getId());    //单据id
		eaTask.setFormCode(eaBusinessApply.getBillNo());   //单据编号
		eaTask.setMemo(eaBusinessApply.getExplainStr());    //备注
		eaTask.setTotalFee(eaBusinessApply.getApplyMoney()); //总金额
		eaTask.setSort("4");   //排序
		eaTask.setTitle("出差申请单");  //标题
		eaTask.setSendManId(eaBusinessApply.getPersonId());    //发送人id
		eaTask.setSendMan(changeIdToNameUtil.getPsnNameById(eaBusinessApply.getPersonId()));    //发送人
		eaTask.setSendDepartId(eaBusinessApply.getDeptId());  //发送人部门id
		eaTask.setSendDepart(changeIdToNameUtil.getNameByDepartId(eaBusinessApply.getDeptId()));   //发送人部门
		eaTask.setSendTime(new Date());    //发送时间
		eaTaskMapper.insert(eaTask);
*/

		returnMap.put("id",eaBusinessApply.getId());
		returnMap.put("code","0");
		returnMap.put("message","保存成功!");
		return returnMap;
	}

	//编辑出差申请单
	@Override
	@Transactional
	public Map<String,Object>  updateMain(EaBusinessApply eaBusinessApply,List<EaBusinessPerDtl> eaBusinessPerDtlList) {
		Map<String,Object> returnMap = new HashMap<String,Object>();

		//如果picture中有http://localhost:9092/qixin-boot/aaa.png,要处理只保留文件名
		String picture = eaBusinessApply.getPicture() != null ? eaBusinessApply.getPicture().toString() : "";
		String picture_final = picture.replaceAll(fileurl,"");;
		//设置最终的图片如:1111.png,2222.png
		eaBusinessApply.setPicture(picture_final);

		String saveType = eaBusinessApply.getSaveType();
		if(saveType.equals("add")) {  //add保存,send提交
			EaBusinessApply eaBusinessApply1 = eaBusinessApplyMapper.selectById(eaBusinessApply.getId());
			eaBusinessApply.setState(eaBusinessApply1.getState());   //单据状态:0未提交,1审批中,2已审批,3已退回
		}else{
			eaBusinessApply.setState(1);   //单据状态:0未提交,1审批中,2已审批,3已退回
		}

		eaBusinessApplyMapper.updateById(eaBusinessApply);

		//删除出行人员明细
		Map<String,Object> params2 = new HashMap<String,Object>();
		params2.put("ea_business_apply_id",eaBusinessApply.getId());
		eaBusinessPerDtlMapper.deleteByMap(params2);

		//再保存出行人员明细表
		if(eaBusinessPerDtlList != null && eaBusinessPerDtlList.size() > 0){
			for (int i = 0; i < eaBusinessPerDtlList.size(); i++) {
				EaBusinessPerDtl eaBusinessPerDtl = eaBusinessPerDtlList.get(i);
				eaBusinessPerDtl.setId(Uuid32Util.getUUid());
				eaBusinessPerDtl.setEaBusinessApplyId(eaBusinessApply.getId());
				eaBusinessPerDtlMapper.insert(eaBusinessPerDtl);
			}
		}

		//修改待办
//		Map<String,Object> paramsMap2 = new HashMap<String,Object>();
//		paramsMap2.put("form_id",eaBusinessApply.getId());
//		List<EaTask> eaTaskList = eaTaskMapper.selectByMap(paramsMap2);
//		for (EaTask eaTask:eaTaskList) {
//			eaTask.setAuditManId(eaBusinessApply.getAuditManId());   //审批人id
//			eaTask.setAuditMan(eaBusinessApply.getAuditMan());    //审批人
//			//提交类型:保存:add,提交:send
//			if(saveType.equals("add")){  //add保存,send提交
//				eaTask.setStatus("0");
//			}else{
//				eaTask.setStatus("1");
//			}
//			eaTask.setFormId(eaBusinessApply.getId());    //单据id
//			eaTask.setFormCode(eaBusinessApply.getBillNo());   //单据编号
//			eaTask.setMemo(eaBusinessApply.getExplainStr());    //备注
//			eaTask.setTotalFee(eaBusinessApply.getApplyMoney()); //总金额
//			eaTask.setSendManId(eaBusinessApply.getPersonId());    //发送人id
//			eaTask.setSendMan(changeIdToNameUtil.getPsnNameById(eaBusinessApply.getPersonId()));    //发送人
//			eaTask.setSendDepartId(eaBusinessApply.getDeptId());  //发送人部门id
//			eaTask.setSendDepart(changeIdToNameUtil.getNameByDepartId(eaBusinessApply.getDeptId()));   //发送人部门
//			eaTask.setSendTime(new Date());    //发送时间
//			eaTaskMapper.updateById(eaTask);
//		}

		returnMap.put("id",eaBusinessApply.getId());
		returnMap.put("code","0");
		returnMap.put("message","编辑成功!");
		return returnMap;
	}

	@Override
	@Transactional
	public Map<String,Object> delMain(String id) {
		Map<String,Object> returnMap = new HashMap<String,Object>();
		EaBusinessApply eaBusinessApply = eaBusinessApplyMapper.selectById(id);

		eaBusinessApplyMapper.deleteById(id);

		//删除相应的待办
		Map<String,Object> paramaMap = new HashMap<String,Object>();
		paramaMap.put("form_id",id);
		List<EaTask> eaTaskList = eaTaskMapper.selectByMap(paramaMap);
		if(eaTaskList != null && eaTaskList.size() > 0){
			EaTask eaTask = eaTaskList.get(0);

			//删除相应的工作流
			workFlowUtil.deleteWorkFlowById(eaTask.getWorkflowTaskId(),eaTask.getProcinstId());

			eaTaskMapper.deleteById(eaTask.getId());
		}

		returnMap.put("code","0");
		returnMap.put("message","删除成功!");
		return returnMap;
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			eaBusinessApplyMapper.deleteById(id);
		}
	}

	//查询出差申请单列表
	@Override
	public Map<String, Object> list(ListPageVo listPageVo) {
		LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		Map<String,Object> map = new HashMap<String,Object>();
		String page = EmptyUtil.checkNull(listPageVo.getPage());
		String limit = EmptyUtil.checkNull(listPageVo.getLimit());
		String keyword = EmptyUtil.checkNull(listPageVo.getKeyword());
		String userid = EmptyUtil.checkNull(listPageVo.getUserid());   //用户id
		String isused = EmptyUtil.checkNull(listPageVo.getIsused());   //是否已使用
		String status = EmptyUtil.checkNull(listPageVo.getStatus());   //状态
		String isChanging = EmptyUtil.checkNull(listPageVo.getIsChanging());   //变更状态
		String billNo = EmptyUtil.checkNull(listPageVo.getBillNo());   //单据编号(pc)
		String billDateBegin = EmptyUtil.checkNull(listPageVo.getBillDateBegin());   //单据日期-开始(pc)
		String billDateEnd = EmptyUtil.checkNull(listPageVo.getBillDateEnd());   //单据日期-结束(pc)
		String personId = EmptyUtil.checkNull(listPageVo.getPersonId());   //申请人/报销人/借款人/还款人(pc)
		String explainStr = EmptyUtil.checkNull(listPageVo.getCasue());   //事由(pc)
		String region = EmptyUtil.checkNull(listPageVo.getRegion());   //目的地(pc)
		String sysOrgCode = EmptyUtil.checkNull(listPageVo.getSysOrgCode());	//所属组织(pc)
		String isAll = listPageVo.getIsAll() != null ? listPageVo.getIsAll().toString() : "1";   //是否所有
		if(isAll.equals("1")){
			// 查询所有单据时，获取登录用户id
			userid = loginUser.getId();
		}
		String keyword1 = "%" + keyword + "%";
		map.put("keyword",keyword1);
		map.put("page",(Integer.parseInt(page) -1) * Integer.parseInt(limit));
		map.put("limit",Integer.parseInt(limit));
		map.put("userid",userid);
		map.put("isused",isused);
		map.put("status",status);
		map.put("isChanging",isChanging);
		map.put("billNo",billNo);
		map.put("billDateBegin",billDateBegin);
		map.put("billDateEnd",billDateEnd);
		map.put("personId",personId);
		map.put("explainStr",explainStr);
		map.put("region",region);
		map.put("isAll",isAll);
		map.put("sysOrgCode",sysOrgCode);
		List<EaBusinessApply> eaBusinessApplyList = eaBusinessApplyMapper.selectBusinessApplys(map);
		if(eaBusinessApplyList != null && eaBusinessApplyList.size() > 0){
			for (EaBusinessApply eaBusinessApply:eaBusinessApplyList) {
				//交通工具
				String trafficTools = eaBusinessApply.getTrafficTools();
				String trafficToolsName = "";
				if(trafficTools != null ){
					if(trafficTools.contains(",")){
						String[] trafficToolss = trafficTools.split(",");
						for (int i = 0; i < trafficToolss.length; i++) {
							if(trafficToolsName.equals("")){
								Map<String,Object> params = new HashMap<String,Object>();
								params.put("item_value",trafficToolss[i]);
								params.put("dict_id","1410511721257771009");
								List<EaSysDictItem> eaSysDictItemList = eaSysDictItemMapper.selectByMap(params);
								if(eaSysDictItemList != null && eaSysDictItemList.size() > 0){
									trafficToolsName = eaSysDictItemList.get(0).getItemText();
								}
							}else{
								Map<String,Object> params = new HashMap<String,Object>();
								params.put("item_value",trafficToolss[i]);
								params.put("dict_id","1410511721257771009");
								List<EaSysDictItem> eaSysDictItemList = eaSysDictItemMapper.selectByMap(params);
								if(eaSysDictItemList != null && eaSysDictItemList.size() > 0){
									trafficToolsName = trafficToolsName + "," + eaSysDictItemList.get(0).getItemText();
								}
							}
						}
					}else{
						Map<String,Object> params = new HashMap<String,Object>();
						params.put("item_value",trafficTools);
						params.put("dict_id","1410511721257771009");
						List<EaSysDictItem> eaSysDictItemList = eaSysDictItemMapper.selectByMap(params);
						if(eaSysDictItemList != null && eaSysDictItemList.size() > 0){
							trafficToolsName = eaSysDictItemList.get(0).getItemText();
						}
					}
				}
				eaBusinessApply.setTrafficToolsName(trafficToolsName);

			}
		}

		int count = 0;
		map.put("page",0);
		map.put("limit",0);
		List<EaBusinessApply> list2 = eaBusinessApplyMapper.selectBusinessApplys(map);
		count = list2.size();
		Map<String,Object> returnMap = new HashMap<String,Object>();
		returnMap.put("records",eaBusinessApplyList);
		returnMap.put("total",count);
		return returnMap;
	}

	//查询出差申请单详情
	@Override
	public Map<String, Object> selectById(String id) {
		//查询出差申请单详情
		Map<String,Object> queryWrapper = new HashMap<String,Object>();
		queryWrapper.put("id",id);  //出差申请单id
		queryWrapper.put("page",0);
		queryWrapper.put("limit",0);
		List<EaBusinessApply> eaBusinessApplyList = eaBusinessApplyMapper.selectBusinessApplys(queryWrapper);
		Map<String,Object> returnMap = new HashMap<String,Object>();
		if(eaBusinessApplyList != null && eaBusinessApplyList.size() > 0){
			EaBusinessApply eaBusinessApply = eaBusinessApplyList.get(0);
			//交通工具
			String trafficTools = eaBusinessApply.getTrafficTools();
			String trafficToolsName = "";
			if(trafficTools != null){
				if(trafficTools.contains(",")){
					String[] trafficToolss = trafficTools.split(",");
					for (int i = 0; i < trafficToolss.length; i++) {
						if(trafficToolsName.equals("")){
							Map<String,Object> params = new HashMap<String,Object>();
							params.put("item_value",trafficToolss[i]);
							params.put("dict_id","1410511721257771009");
							List<EaSysDictItem> eaSysDictItemList = eaSysDictItemMapper.selectByMap(params);
							if(eaSysDictItemList != null && eaSysDictItemList.size() > 0){
								trafficToolsName = eaSysDictItemList.get(0).getItemText();
							}
						}else{
							Map<String,Object> params = new HashMap<String,Object>();
							params.put("item_value",trafficToolss[i]);
							params.put("dict_id","1410511721257771009");
							List<EaSysDictItem> eaSysDictItemList = eaSysDictItemMapper.selectByMap(params);
							if(eaSysDictItemList != null && eaSysDictItemList.size() > 0){
								trafficToolsName = trafficToolsName + "," + eaSysDictItemList.get(0).getItemText();
							}
						}
					}
				}else{
					Map<String,Object> params = new HashMap<String,Object>();
					params.put("item_value",trafficTools);
					params.put("dict_id","1410511721257771009");
					List<EaSysDictItem> eaSysDictItemList = eaSysDictItemMapper.selectByMap(params);
					if(eaSysDictItemList != null && eaSysDictItemList.size() > 0){
						trafficToolsName = eaSysDictItemList.get(0).getItemText();
					}
				}
			}
			eaBusinessApply.setTrafficToolsName(trafficToolsName);

			//将实体数据存到map
			returnMap = JSON.parseObject(JSON.toJSONString(eaBusinessApply, SerializerFeature.WriteMapNullValue), Map.class);

			BigDecimal applyMoney = eaBusinessApply.getApplyMoney() != null ? eaBusinessApply.getApplyMoney() : new BigDecimal(0);
			String applyMoneyStr = ConvertUpMoneyUtil.toChinese(String.valueOf(applyMoney));
			returnMap.put("applyMoney_cn",applyMoneyStr);    //申请金额

			//格式化时间
			Long createTime = returnMap.get("createTime") != null ? Long.parseLong(returnMap.get("createTime").toString()) : null;
			String createTimeStr = DateFormatUtil.formatDateyyMMddHHmmss(createTime);
			returnMap.put("createTime",createTimeStr);

			//格式化时间
			Long updateTime = returnMap.get("updateTime") != null ? Long.parseLong(returnMap.get("updateTime").toString()) : null;
			String updateTimeStr = DateFormatUtil.formatDateyyMMddHHmmss(updateTime);
			returnMap.put("updateTime",updateTimeStr);

			//更新时间-用于校验时效性
			returnMap.put("time",updateTimeStr);

			//格式化时间
			Long billDate = returnMap.get("billDate") != null ? Long.parseLong(returnMap.get("billDate").toString()) : null;
			String billDateStr = DateFormatUtil.formatDateyyMMdd(billDate);
			returnMap.put("billDate",billDateStr);

			//格式化时间
			Long startDate = returnMap.get("startDate") != null ? Long.parseLong(returnMap.get("startDate").toString()) : null;
			String startDateStr = DateFormatUtil.formatDateyyMMdd(startDate);
			returnMap.put("startDate",startDateStr);

			//格式化时间
			Long endDate = returnMap.get("endDate") != null ? Long.parseLong(returnMap.get("endDate").toString()) : null;
			String endDateStr = DateFormatUtil.formatDateyyMMdd(endDate);
			returnMap.put("endDate",endDateStr);

			//添加图片
			String picture = returnMap.get("picture") != null ? returnMap.get("picture").toString() : "";
			List<Map<String,Object>> fileList = GetUrlUtil.getUrl(picture,fileurl);

			//添加图片fileList
			returnMap.put("fileList",fileList);

			//添加出行人员明细
			Map<String,Object> eaBusinessPerDtlMap = new HashMap<String,Object>();
			eaBusinessPerDtlMap.put("ea_business_apply_id",id);
			List<EaBusinessPerDtl> eaBusinessPerDtlList = eaBusinessPerDtlMapper.selectByMap(eaBusinessPerDtlMap);
			List<Map<String,Object>> eaBusinessPerDtlMapList = new ArrayList<Map<String,Object>>();
			if(eaBusinessPerDtlList != null && eaBusinessPerDtlList.size() > 0){
				for (int i = 0; i < eaBusinessPerDtlList.size(); i++) {
					Map<String,Object> eaBusinessPerDtlMap2 = JSON.parseObject(JSON.toJSONString(eaBusinessPerDtlList.get(i), SerializerFeature.WriteMapNullValue), Map.class);
					//格式化时间
					Long createTime1 = eaBusinessPerDtlMap2.get("createTime") != null ? Long.parseLong(eaBusinessPerDtlMap2.get("createTime").toString()) : null;
					String createTime1Str = DateFormatUtil.formatDateyyMMddHHmmss(createTime1);
					eaBusinessPerDtlMap2.put("createTime",createTime1Str);

					//格式化时间
					Long updateTime1 = eaBusinessPerDtlMap2.get("updateTime") != null ? Long.parseLong(eaBusinessPerDtlMap2.get("updateTime").toString()) : null;
					String updateTime1Str = DateFormatUtil.formatDateyyMMddHHmmss(updateTime1);
					eaBusinessPerDtlMap2.put("updateTime",updateTime1Str);

					//格式化时间-开始时间
					Long startDateDtl = eaBusinessPerDtlMap2.get("startDateDtl") != null ? Long.parseLong(eaBusinessPerDtlMap2.get("startDateDtl").toString()) : null;
					String startDateDtlStr = DateFormatUtil.formatDateyyMMdd(startDateDtl);
					eaBusinessPerDtlMap2.put("startDateDtl",startDateDtlStr);

					//格式化时间-结束时间
					Long endDateDtl = eaBusinessPerDtlMap2.get("endDateDtl") != null ? Long.parseLong(eaBusinessPerDtlMap2.get("endDateDtl").toString()) : null;
					String endDateDtlStr = DateFormatUtil.formatDateyyMMdd(endDateDtl);
					eaBusinessPerDtlMap2.put("endDateDtl",endDateDtlStr);

					//格式化人员名称
					String personnel2 = EmptyUtil.checkNull(eaBusinessPerDtlMap2.get("personnel"));
					String personnel2Name = changeIdToNameUtil.getPsnNameById(personnel2);
					eaBusinessPerDtlMap2.put("personnelName",personnel2Name);
					eaBusinessPerDtlMap2.put("personnelIdName",personnel2Name);

					//添加借款单明细
					eaBusinessPerDtlMapList.add(eaBusinessPerDtlMap2);
				}
			}

			//将明细信息加入返回节点
			returnMap.put("eaBusinessPerDtlList",eaBusinessPerDtlMapList);
		}
		return returnMap;
	}

	@Override
	@Transactional
	public Map<String, Object> audit(EaTaskVo eaTaskVo) {
		Map<String,Object> returnMap = new HashMap<String,Object>();
		String id = EmptyUtil.checkNull(eaTaskVo.getId());   //单据id
//        String auditManId = EmptyUtil.checkNull(eaTaskVo.getAuditManId());   //审批人id
//        String auditMan = EmptyUtil.checkNull(eaTaskVo.getAuditMan());   //审批人
		String auditComment = EmptyUtil.checkNull(eaTaskVo.getAuditComment());   //审批意见
		String status = EmptyUtil.checkNull(eaTaskVo.getStatus());   //单据状态:2通过,3退回

		//获取出差申请单-更新状态
		EaBusinessApply eaBusinessApply = eaBusinessApplyMapper.selectById(id);
		eaBusinessApply.setState(Integer.parseInt(status));
		eaBusinessApplyMapper.updateById(eaBusinessApply);

		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put("form_id",eaBusinessApply.getId());
		List<EaTask> eaTaskList = eaTaskMapper.selectByMap(paramsMap);
		if(eaTaskList != null && eaTaskList.size() > 0){
			EaTask eaTask = eaTaskList.get(0);
			//eaTask.setAuditManId(auditManId);
			//eaTask.setAuditMan(auditMan);
			eaTask.setAuditComment(auditComment);
			eaTask.setStatus(status);

			try {
				if(status.equals("3") || status.equals("2")){
					eaTask.setFinishTime(new Date());   //完成时间
				}
				eaTask.setAuditTime(new Date());    //审批时间
				eaTaskMapper.updateById(eaTask);

				returnMap.put("code","0");
				returnMap.put("message","审核成功!");
				return returnMap;
			}catch (Exception e){
				returnMap.put("code","-1");
				returnMap.put("message","系统异常,审核失败!");
				return returnMap;
			}
		}else{
			returnMap.put("code","-1");
			returnMap.put("message","待办不存在!");
			return returnMap;
		}
	}

}
